<?php
$stacks = array ();
if ( config::get ( 'error_detail' ) == true ) {
	$stacks = debug_backtrace ( );
	array_shift ( $stacks );
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="Text/Html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="keywords" content="php,vanephp,php框架" />
<meta http-equiv="description" content="<?php echo APP_NAME . APP_VERSION; ?>错误" />
<meta http-equiv="author" content="<?php echo APP_NAME . APP_VERSION; ?>" />
<meta http-equiv="copyright" content="<?php echo APP_COPYRIGHT; ?>" />
<title><?php echo APP_NAME . APP_VERSION;?>运行时错误：<?php echo $errstr;?></title>
<style type="text/css">
body {
	padding: 0px;
	background: #efefef;
	color: #333333;
	font-size: 12px;
	margin: 0px;
}

.shadow {
	width: 960px;
	border: 2px solid #DDDDDD;
	margin: 20px auto 20px auto;
	border-width: 0px 2px 2px 0px;
}

#errinfo {
	width: 938px;
	padding: 10px;
	background: #ffffff;
	border: 1px solid #aaaaaa;
	background: #ffffff;
}

#info {
	font-family: 微软雅黑, 黑体, 宋体, arial;
	margin: 0px;
	margin: 0px;
}

h1,h2 {
	margin: 0px;
	padding: 0px;
}

h1 {
	padding: 5px;
	line-height: 40px;
	color: #ffffff;
	background-color: #5f6e7c;
}

.e<?php echo E_CORE_ERROR ?>,.e<?php echo E_COMPILE_ERROR ?>,.e<?php echo E_ERROR ?>,.e<?php echo E_USER_ERROR ?> {
	background-color: #ff0000;
}

.e<?php echo E_CORE_WARNING ?>,.e<?php echo E_COMPILE_WARNING ?>,.e<?php echo E_WARNING ?>,.e<?php echo E_USER_WARNING ?> {
	background-color: #292784;
}

.e<?php echo E_NOTICE ?>,.e<?php echo E_USER_NOTICE ?> {
	background-color: #ff7e00;
}
	

h2 {
	color: #666666;
	line-height: 35px;
	height: 35px;
}

ol {
	
}

h1 a {
	padding: 2px;
	color: #FFFF00;
}

ol li {
	padding-right: 10px;
	margin-bottom: 10px;
}

.filepath {
	font-size: 14px;
	line-height: 30px;
	margin: 0px;
	font-weight: bold;
	margin: 0px;
}

.code {
	border: 1px solid #cccccc;
	border-color: #999999 #dddddd #dddddd #999999;
}

.codeline {
	line-height: 20px;
	font-family: arial;
}

.breakline {
	background-color: #CCCCCC;
}

.breaknbsp {
	color: #ff0000;
	border-right: 1px solid #efefef;
	font-family: tahoma;
	padding-right: 5px;
	margin-right: 10px;
	width: 50px;
	float: left;
	display: block;
	font-size: 12px;
	text-align: right;
	font-family: tahoma;
}

.nbsp {
	color: #999999;
	border-right: 1px solid #efefef;
	font-family: tahoma;
	padding-right: 5px;
	margin-right: 10px;
	width: 50px;
	float: left;
	text-align: right;
	font-size: 12px;
	display: block;
	border-right: 1px solid #efefef;
}

#vanelogo {
	float: right;
}

#nodetailinfo {
	font-size: 14px;
	line-height: 40px;
}
</style>
</head>
<body>
<div class="shadow">
<div id="errinfo">
<div id="info">
<div id="vanelogo"><span style="float: left">powered&nbsp;by&nbsp;</span><a
	href="<?php
	echo APP_COPYRIGHT;
	?>" target="_blank"><img border="0"
	alt="<?php
	echo APP_NAME . APP_VERSION;
	?>" src="?vanelogo=true" /></a></div>
<h2><?php
echo APP_NAME . APP_VERSION;
?> 运行时错误：</h2>
<h1 class="e<?php echo $errno;?>"><?php echo $errstr;?>&nbsp;<a href="<?php echo URI;?>" onclick="document.location.reload();">[重试]</a></h1>
</div>
<?php
if ( $stacks ) {
?>
<ol>
<?php
	foreach ( $stacks as $i => $stack ) {
		if ( is_array ( $stack ) && isset ( $stack["file"] ) ) {
			$souceline = getErrorSource ( $stack["file"], $stack["line"] );
			if ( $souceline ) {
				?>
	<li>
	<p class="filepath">
		文件：<?php
				echo $stack["file"];
				?>
		行号：<?php
				echo $stack["line"];
				?>
		</p>
	<div class="code">
<?php
				foreach ( $souceline as $singleline )
					echo $singleline;
				?>
		</div>
	</li>
<?php
			}
		}
	}
	?>
<?php
} else {
	?>
<div id="nodetailinfo">框架关闭了错误跟踪信息，需要显示详细信息请参考提示修改配置：
	<p class="filepath">
		文件：<?php
	echo getAppFilename ( );
	?>
		行号：<?php
	$linecode = '';
	$lineno = 0;
	foreach ( file ( $_SERVER['DOCUMENT_ROOT'] . getAppFilename ( ) ) as $lno => $v ) {
		if ( preg_match ( '/\s?vane::run.*/', $v ) ) {
			$lineno = $lno;
			$linecode = $v;
		}
	}
	$lineno ++;
	echo $lineno;
	?>
		</p>
	<div class="code">
		<?php
	echo '<div class="codeline breakline"><span class="breaknbsp">→' . $lineno . '</span>' . highlightSource ( $linecode, TRUE ) . '</div>';
	?>
	</div>
	修改为：
	<div class="code">
	<?php
	$linecode = preg_replace ( '/\(.*\)/', "( 'debug' )", $linecode );
	echo '<div class="codeline"><span class="nbsp">' . $lineno . '</span>' . highlightSource ( $linecode, TRUE ) . '</div>';
	?>
	</div>
	</div>
<?php
}
?>
</ol>
</div>
</div>
</body>
</html>